#pragma once
#include <stdint.h>
#include "dataclient.h"
#include <endian.h>
#include <string.h>
#include "helpers.h"

namespace openitch {

class dataclient;

class itch41reader
{
public :
	itch41reader(dataclient *, int bufsize);
	~itch41reader();
	char processpacket(int fd);
	long getmsgcount() const { return msgcount; }
	long elapsed() const { return starttime ? gettime() - starttime : 0; }
	//static int const symbolSize = 8;
	long bytesread;
private :
	dataclient* wrapper;
	long starttime;
	long msgcount;
	short pktsize;
	int pktposition;
	char* buf;
	int bufsize;

	void bufferedread(int fd);
};
}

